package com.ggbz.mapper;

import com.ggbz.entity.CounselorClasses;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 辅导员负责班级表，存储辅导员与班级的关联关系 Mapper 接口
 * </p>
 *
 * @author ggbz
 * @since 2025-03-08
 */
public interface CounselorClassesMapper extends BaseMapper<CounselorClasses> {
    @Select("SELECT counselor_id, class_name FROM counselor_classes WHERE counselor_id = #{counselorId}")
    List<CounselorClasses> selectClassesByCounselorId(@Param("counselorId") Long counselorId);

    /**
     * 根据辅导员ID和班级名称删除记录
     *
     * @param counselorId 辅导员ID
     * @param className   班级名称
     */
    @Delete("DELETE FROM counselor_classes WHERE counselor_id = #{counselorId} AND class_name = #{className}")
    void deleteByCounselorIdAndClassName(Long counselorId, String className);
}
